Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check nullCount in Series.toTypedArray #207

Merged

Conversation

controversial
Copy link
Contributor

@controversial controversial commented Apr 24, 2024

Don’t rely solely on has_validity to determine whether a series contains nulls

From the Python documentation for has_validity (emphasis mine):

While the absence of a validity bitmask guarantees that a Series does not have null values, the converse is not true, eg: the presence of a bitmask does not mean that there are null values, as every value of the bitmask could be false.

To confirm that a column has null values use null_count().

This PR modifies the logic for Series.toTypedArray (in line with the note quoted above) to check nullCount() if the Series hasValidity(), rather than relying on the hasValidity() check alone.

Closes #206

@controversial
Copy link
Contributor Author

controversial commented Apr 25, 2024

Ran lint:ts:fix to address lint failure in the previous CI run

@universalmind303 universalmind303 merged commit 5d05a19 into pola-rs:main Apr 29, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Series.toTypedArrays() fails after .dropNulls()
2 participants